clear

cd "/Volumes/Work/Work Space/Projects/Dataverse/META"

use "/Volumes/Work/Work Space/Projects/META/Work/final cleaning/questionnaire_adh.dta", clear

keep studyid pickone_p visno status sa participant_preference_specify disenrollment_other reason_for_disrollment disenrollment_other reason_for_disrollment group cd4_count blogvl ///
female age_calculation married sexually_active can_read* regular_income employed sex_money struct_barrier_score alter_insupp_tot alter_emsupp_tot fi_severe stigma_pna ///
stigma_dc told_anyone disclosed_outside_hh necessity_tert necessity_score concerns_score coping_score_wr conspiracy_score satisfaction_score firstpostv_over30 other_meds_besides_art ///
PCS_12 MCS_12 depressbi auditc_yesno smoke_cigarette heduc_sec  mistrust_score num7_p num7_v suppressed_impute graduate other_meds_besides_art med_toxic med_good_idea med_not_proven ///
clinic_too_far much_time_to_clinic transport_clinic no_time_away_from_work noone_look_after_children know_hiv_status_p relationship_sex_p1_1 firstpostv_over30 disenrollment_date ///
enrollment_date concerns_tert smoke_cigarette1 ave_p ave_v running_water annual_income_usd annual_spent_usd denial_score denial_score med_toxic1 med_not_proven1 clinic_too_far1 ///
much_time_to_clinic1 transport_clinic1 no_time_away_from_work1 noone_look_after_children1 smoke_marijuana1 other_drugs1 forced_sex1* sex_money1 slapped1 disclosed_hh hiv_status_p1 ///
alter_insupp_tot10 literate alter_emsupp_prop alter_emsupp_tot10 running_water annual_income_usd annual_spent_usd denial_score med_good_idea1 med_toxic1 med_not_proven1 ///
alter_insupp_prop n_p forced_sex smoke_marijuana slapped

local var  married heduc_sec employed literate fi_severe auditc_yesno firstpostv_over30 smoke_marijuana1 smoke_cigarette1 other_drugs1 ///
med_good_idea1  no_time_away_from_work1 noone_look_after_children1 sex_money1 suppressed_impute female disclosed_hh depressbi sexually_active ///
sexually_active 
 
foreach x of local var {
label values `x' yesno
}

label define tertile 0 "low" 1 "medium" 2 "high"
label values necessity_tert tertile
label values concerns_tert tertile

label define sa 0 "Mbarara" 1 "Cape Town"
label values sa sa 
label var sa "Country"
label define group  1 "early initiators" 2 "pregnant" 3 "late initiators"
label values group group

label define visno 0 "Baseline" 1 "Month6" 2 "Month12"
label values visno visno

label var age_calculation "Age at study enrollment"
label var married "Is participant married to one or more partners?"
label var denial_score "Denial score"
label var studyid "Participant's unique identifier"
label var auditc_yesno "Audit score>3 and female or auditc score>4 and male"
label var PCS_12 "MOSHIV12 Physical health score"
label var MCS_12 "MOSHIV12 Mental health score"
label var denial_score "Denial score"
label var coping_score_wr "Maladaptive coping score"
label var satisfaction_score "Clinic satisfaction score"
label var necessity_score "Necessity of taking ART score"
label var concerns_score "Concerns about taking ART score"
label var mistrust_score "Medical mistrust score"
label var struct_barrier_score "Structural barrier score"
label var conspiracy_score "Medical conspiracy score"
label var suppressed_impute "Virally suppressed (VL<400) considering the lost + died as unsuppressed."
label var heduc_sec "Secondary as highest level of education"
label var literate "Literate in English or local language"
label var fi_severe "Severe food insecurity"
label var blogvl "Baseline viral load (log)"
label var firstpostv "Was first HIV positive test conducted over 30 days before enrollment?"
label var med_good_idea1 "Taking HIV medication is a good idea even if one doesn't have symptoms"
label var med_toxic1 "HIV medications are too toxic or poisonous for most people"
label var med_not_proven1 "HIV medications have not been proven effective - binary"
label var forced_sex1 "In the past 6 months, have you had sex because your partner gave you or you expe -  binary"
label var sex_money1 "Has anyone ever physically forced you to have sex when you did not want to? - binary"
label var necessity_tert "Necessity of taking ART score - tertiles"
label var concerns_tert "Concerns about taking ART score - tertiles"
label var disclosed_hh "Has participant disclosed HIV status to people in the home s/he usually live in."
label var employed "Is participant in paid or non paid employment or school"
label var slapped1 "Have any of your sexual partners ever Pushed, pulled, slapped, or held you down? - binary"
label var sexually_active "Has had a sexual partner(s) in past 6 months"
label var status "Follow-up status at study end"
label var ave_p "Average Wisepilll adherence over course of follow-up"
label var clinic_too_far1 "1. The clinic is too far - binary"
label var smoke_marijuana1 "Have you ever smoked marijuana? - binary"
label var smoke_cigarette1 "Have you ever smoked cigarettes? - binary"
label var other_drugs1 "Have you ever used other recreational drugs? - binary"
label var alter_insupp_tot10 "Total alter emotional support score/10"
label var alter_emsupp_tot10 "Total alter instrumental support score/10"
label var much_time_to_clinic1 "2. It takes too much time to travel to and from the clinic - binary"
label var transport_clinic1 "12. I do not have the money to pay for transportation to the clinic - binary"
label var no_time_away_from_work1 "7. I cannot get time away from school or work"
label var noone_look_after_children1 "13. I cannot get someone to look after my children"
label var relationship_sex_p1_1 "Relationship with primary sexual partner"
label var graduate  "Did participant graduate Wisepill?"

order studyid sa group age_calculation female married heduc_sec employed cd4_count blogvl firstpostv_over30 literate can_read_english can_read_local enrollment_date  visno suppressed_impute smoke_cigarette ///
smoke_cigarette1 smoke_marijuana smoke_marijuana1 auditc_yesno other_meds_besides_art other_drugs1 regular_income running_water annual_income_usd annual_spent_usd ///
PCS_12 MCS_12 fi_severe denial_score coping_score_wr med_good_idea med_good_idea1 med_toxic med_toxic1 med_not_proven med_not_proven1 struct_barrier_score clinic_too_far clinic_too_far1 ///
much_time_to_clinic much_time_to_clinic1 no_time_away_from_work no_time_away_from_work1 transport_clinic transport_clinic1 noone_look_after_children ///
noone_look_after_children1 sex_money sex_money1 forced_sex forced_sex1 forced_sex1 slapped slapped1  told_anyone disclosed_hh disclosed_outside_hh stigma_pna stigma_dc ///
satisfaction_score necessity_score necessity_tert concerns_score concerns_tert depressbi mistrust_score conspiracy_score sexually_active relationship_sex_p1_1 ///
hiv_status_p1 know_hiv_status_p1 alter_emsupp_prop alter_emsupp_tot alter_insupp_prop alter_insupp_tot alter_insupp_tot10 alter_emsupp_tot10 ave_v ///
num7_v ave_p num7_p n_p status graduate reason_for_disrollment disenrollment_date participant_preference_specify disenrollment_other pickone_p

drop med_good_idea med_good_idea1 med_toxic med_toxic1 med_not_proven med_not_proven1 clinic_too_far clinic_too_far1 much_time_to_clinic ///
much_time_to_clinic1 no_time_away_from_work no_time_away_from_work1 transport_clinic transport_clinic1 noone_look_after_children noone_look_after_children1 ///
forced_sex1 sex_money1 alter_emsupp_prop alter_emsupp_tot alter_insupp_prop alter_insupp_tot alter_insupp_tot10 alter_emsupp_tot10 sex_money1 forced_sex1 ///
smoke_cigarette1 smoke_marijuana1 other_drugs1 relationship_sex_p1_1 hiv_status_p1 know_hiv_status_p1 graduate reason_for_disrollment disenrollment_date disenrollment_other ///
participant_preference_specify slapped1 pickone_p

* deidentify enrollment date
replace enrollment_date=enrollment_date-20152
format enrollment_date %9.0g
label var enrollment_date "Days from study start date"

save meta_aim_1.dta, replace
export excel using meta_aim_1.xlsx, replace firstrow(var)
